package com.framework.loippi.controller.api;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.framework.loippi.support.Message;
import com.framework.loippi.support.Pageable;

/**
 * API - ${functionName}接口
 * 
 * @author ${author!'Loippi Team'}
 * @version ${version!'2.0'}
 */
@Controller("api${moduleName?cap_first}Controller")
public class ${moduleName?cap_first}APIController extends GenericController {

	<#list interfacers as inface>
	/**
	 * ${inface.name}
	 */
	@RequestMapping(value = "${inface.url}", method = RequestMethod.${inface.method})
	public @ResponseBody String ${inface.functionName}(${inface.functionName}Param param) {
		//TODO You can do something !
		
		<#if inface.results?? && inface.results?size gt 0>
		${inface.functionName}Result result = new ${inface.functionName}Result().debug();
		return ApiUtils.success(result);
		<#else>
		return ApiUtils.success();
		</#if>
	}
	
	</#list>
}
